<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>题目编辑</title>
    <c:import url="/layout/_imports.jsp"></c:import>
</head>
<body>
<c:import url="/layout/_nav.jsp"></c:import>
<div class="container">
    <h2>编辑题目</h2>

    <form action="/paper/item/update" method="post">
        <input type="hidden" name="paperId" value="${paperId}">
        <input type="hidden" name="id" value="${item.id}">
        <input type="hidden" name="page" value="${page}">
        <input type="hidden" name="size" value="${size}">
        <div class="form-group row">
            <label class="col-sm-2" for="title">题目</label>
            <div class="col-sm-10">
                <input class="form-control" id="title" type="text" name="title" value="${item.title}">
            </div>
        </div>
        <div class="form-group row">
            <label class="col-sm-2" for="content">内容</label>
            <div class="col-sm-10">
                <input class="form-control" id="content" type="text" name="content" value="${item.content}">
            </div>
        </div>

        <div class="form-group row">
            <label for="answer" class="col-sm-2">答案</label>
            <div class="col-sm-10">
                <input class="form-control" id="answer" type="text" name="answer" value="${item.answer}">
            </div>
        </div>
        <div class="form-group row">
            <label class="col-sm-2">题型</label>
            <div class="col-sm-10">
                <select class="form-control" name="typeId">
                    <c:forEach varStatus="type" items="${types}" var="t">
                        <option value='${t.name =="单选" ? "single": "multiple" }' <c:if test="${t.id == item.typeId}">selected</c:if>>${t.name}</option>
                    </c:forEach>
                </select>
            </div>
        </div>


        <button type="submit" class="btn btn-primary">保存</button>
        <a href="/paper/itemsManage?id=${paperId}" class="btn btn-secondary">返回列表</a>
    </form>
</div>
</body>
</html>
